package cn.wit.contest.service.impl;

import cn.wit.contest.condition.ContestHistoryInfoCondition;
import cn.wit.contest.mapper.ContestHistoryInfoMapper;
import cn.wit.utils.pojo.ContestHistoryInfo;
import cn.wit.utils.pojo.ContestInfoDataAnalyze;
import cn.wit.contest.service.ContestHistoryInfoService;
import cn.wit.utils.response.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Service
public class ContestHistoryInfoServiceImpl implements ContestHistoryInfoService {
    @Autowired
    private ContestHistoryInfoMapper contestHistoryInfoMapper;

    @Override
    public Result getContestHistoryInfo() {
        List<ContestInfoDataAnalyze> contestHistoryInfo = contestHistoryInfoMapper.getContestHistoryInfo();
        if (CollectionUtils.isEmpty(contestHistoryInfo)) {
            return Result.ok(new ArrayList<>());
        }
        return Result.ok(contestHistoryInfo);
    }
}